/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package eks.diverse;

import eks.simpla.Eks5_vejrudsigt_flytbar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

/**
 *
 * @author Jacob Nordfalk
 */
public class Eks_menuer extends Activity {
  private TextView tv;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
		tv=new TextView(this);
    tv.setText("Tryk på menu-knappen\n");
		setContentView(tv);
  }


  @Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		tv.append("\nonKeyDown "+keyCode);
		return super.onKeyDown(keyCode, event);
	}

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  		tv.append("\nonCreateOptionsMenu "+menu);
      menu.add(Menu.NONE, 1, Menu.NONE, "Start vejrudsigt");
      menu.add(Menu.NONE, 2, Menu.NONE, "Afslut").setIcon( android.R.drawable.ic_delete );
      return true;
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    tv.append("\nonOptionsItemSelected(" +item.getTitle());
    if (item.getItemId() == 1) {
      Intent i = new Intent(this, Eks5_vejrudsigt_flytbar.class);
      startActivity(i);
    } else if (item.getItemId() == 2) {
      finish();
    }
    return true;
  }
}

